﻿package mortal.game.view.lotteryDraw
{
    import Message.Public.*;
    import com.mui.controls.*;
    import com.mui.utils.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.item.*;
    import mortal.game.view.common.tooltip.tooltips.data.*;

    public class lotteryDrawRecordRareItemCellRender extends GCellRenderer implements IToolTipItem
    {
        private var _rareItem:BaseItem;
        private var _serverPlayerName:String;

        public function lotteryDrawRecordRareItemCellRender()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._rareItem = UICompomentPool.getUICompoment(BaseItem);
            this._rareItem.setItemStyle(ItemStyleConst.Small, ImagesConst.PackItemBg, 2, 2);
            this.addChild(this._rareItem);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._rareItem.dispose(param1);
            this._rareItem = null;
            super.disposeImpl(param1);
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            var _loc_6:int = 0;
            var _loc_7:* = undefined;
            var _loc_8:* = undefined;
            super.data = param1;
            var _loc_2:* = param1["recordInfo"] as SLotteryRecord;
            this._serverPlayerName = lotteryDrawUtil.getRoleProxyName(_loc_2.entityId) + _loc_2.playerName;
            var _loc_3:int = -1;
            var _loc_4:int = 0;
            var _loc_5:int = 0;
            for (_loc_7 in _loc_2.lotteryItems)
            {
                
                _loc_3 = int(_loc_7);
            }
            for (_loc_8 in _loc_2.lotteryGold)
            {
                
                _loc_4 = int(_loc_8);
                _loc_5 = _loc_2.lotteryGold[_loc_8];
            }
            if (_loc_3 > 0)
            {
                _loc_6 = _loc_3;
            }
            else if (_loc_4 > 0)
            {
                _loc_6 = lotteryDrawConst.diamondIDDic[_loc_4];
                this._rareItem.isBind = false;
            }
            var _loc_9:* = new ToolTipLotteryDrawRareItemData();
            if (_loc_6 && _loc_6 != 0)
            {
                _loc_9.itemCode = _loc_6;
                this._rareItem.itemCode = _loc_6;
            }
            _loc_9.playerName = this._serverPlayerName;
            _loc_9.money = _loc_5;
            this.toolTipData = _loc_9;
            return;
        }// end function

    }
}
